(function () {
    var expect = chai.expect;

    function testGetStorageSync() {
        describe("getStorageSync", function () {
            it("should not have a key is a should be null", function(done) {
                var ret = aui.getStorageSync("a");
                expect(ret).to.be.a('null');
                done();
            })
        });
    }

    function asyncFun() {
        return new Promise(function (resolve, reject) {
            resolve();
        })
    }

    function testSetStorageSync() {
        describe("setStorageSync", function () {
            it("should set storage key a success", function(done) {
                asyncFun().then(function () {
                    aui.setStorageSync("a", {a: 1});
                    var ret = aui.getStorageSync("a");
                    expect(ret).to.have.all.keys('a');
                    expect(ret.a).to.equal(1);
                    done();
                }).catch(function (err) {
                    done(err);
                })
            })
        });
    }

    function testUpdateStorageSync() {
        describe("replaceStorage", function () {
            it("should replace storage key a new value", function(done) {
                aui.updateStorageSync("a", {a: 3});
                var ret = aui.getStorageSync("a");
                expect(ret).to.have.all.keys('a');
                expect(ret.a).to.equal(3);
                done();
            })
        });
    }

    function testRemoveStorageSync() {

    }

    function testClearStorageSync() {

    }

    describe("aui", function() {
        aui.clearStorageSync();
        testGetStorageSync();
        testSetStorageSync();
        testUpdateStorageSync();
    });
})()